#ifndef MTWIDGET_H
#define MTWIDGET_H


#include "GestureEvent.h"
#include "qtuiolistener.h"
#include <QtGui>
class MTWidget : public QGraphicsWidget
{
public:
    MTWidget(QWidget * parent);
    ~MTWidget();
    void onTouch(int touchId, double x, double y, int );
signals:
    void rotated();
    void dragged();
    void zoomed();

private:
    QMap<int,QPointF> touches;
    bool acceptGesture, rotates, isZoomable, isDraggable;
    qreal rotationFactor, scaleFactor;
    void rotateZoomMove(int touchId, QPointF pos);
    int findSecondTouch(int touchId);
    bool onTouchDown(int touchId, QPointF pos);
    bool onTouchUp(int touchId, QPointF pos);
    bool onTouchMove(int touchId, QPointF pos);
    bool onGesture(MTGestureEvent);

protected:
    void mouseMoveEvent( QMouseEvent * event);

};

#endif // MTWIDGET_H
